<template>
  <el-table
      v-loading="loading"
      element-loading-text="拼命加载中"
      :data="tableData"
      style="width: 100%">
    <el-table-column
        prop="id"
        label="提交编号"
        width="120">
    </el-table-column>
    <el-table-column
        prop="resultCode"
        label="结果代码"
        v-if="false">
    </el-table-column>
    <el-table-column
        prop="result"
        label="结果">
      <template #default="scope">
        <el-tag :type="scope.row.resultCode in color?color[scope.row.resultCode]:defaultColor"
                effect="dark"
                size="small">
          {{ scope.row.result }}
        </el-tag>
      </template>
    </el-table-column>
    <el-table-column
        prop="problem"
        label="题目">
    </el-table-column>
    <el-table-column
        prop="language"
        label="语言">
    </el-table-column>
    <el-table-column
        prop="time"
        label="时间消耗">
    </el-table-column>
    <el-table-column
        prop="memory"
        label="内存消耗">
    </el-table-column>
    <el-table-column
        prop="submitTime"
        label="提交时间">
    </el-table-column>
  </el-table>
</template>

<script>
export default {
  name: "SubmitRecordTable",
  props: {
    tableData: Array,
    loading: Boolean
  },
  data() {
    return {
      color:{2:'danger', 4:'success', 6:'danger', 7:'danger', 8:'danger', 9:'danger',
            10:'warning', 11:'warning'},
      defaultColor: 'info'
    }
  }
}
</script>

<style scoped>

</style>